
function fun(){
    console.log("fun")
}

fun()

function funs(): string{
    return "funs"
}

console.log(funs())

function funsParams(str: string){
    console.log(str)
}
funsParams("zhang san")

//可忽略参数
function funsParams1(p1: string ,p?: string){
    console.log(p1)
    if (p){
         console.log(p) 
    }
  
}
funsParams1("p1")
funsParams1("p1","p")

//默认参数值
function funsParams2(p1: string ,p: string="ddp"){
    console.log(p1)
    console.log(p)
}
funsParams2("p1")
funsParams2("p1","p")

//可变参数
function funsParams3(p1: string ,...p: string[]){
    console.log(p1)
    console.log(p)
}

funsParams3("p1","p","p","p")

//匿名函数
var nfun = function(){
    console.log("nfun")
}
nfun();

//匿名函数自调用
(function(){
    console.log("nnnfun")
})()

//lambda
var nmfun = (n: string) => {
    console.log(n)
}
nmfun("lambda");

var s = "sss"
console.log(typeof s=="number")

//单参数 （）可以省略
var lfun = (x: string) => {
    console.log(x)
}

lfun("xx");

//方法重载
// function aa(a: string){
//     console.log(a)
// }

// function aa(n: number){
//     console.log(n)
// }


// aa("aa")
// aa(11)